package com.smile.controller;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smile.commons.page.MyBatisPlusPageConverter;
import com.smile.commons.page.R;
import com.smile.model.dto.request.EditAirportRequestDTO;
import com.smile.model.dto.request.GetAirportByIdRequestDTO;
import com.smile.model.dto.request.GetAirportListRequestDTO;
import com.smile.model.dto.request.GetInspectionTaskListRequestDTO;
import com.smile.model.request.EditAirportRequest;
import com.smile.model.request.GetAirportByIdRequest;
import com.smile.model.request.GetAirportDetailInfoRequest;
import com.smile.model.request.GetAirportListRequest;
import com.smile.model.response.Drone;
import com.smile.model.response.GetAirportByIdResponse;
import com.smile.model.response.GetAirportListResponse;
import com.smile.model.response.response.GetAirportByIdResponseDTO;
import com.smile.model.response.response.GetAirportListResponseDTO;
import com.smile.model.response.response.GetInspectionTaskListResponseDTO;
import com.smile.service.AirportService;
import com.smile.service.SituationScreenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/situationscreen")
public class SituationScreenController {

    @Autowired
    private SituationScreenService situationScreenService;

    /**
     * 态势大屏详情
     * @param getAirportDetailInfoRequest
     * @return
     * @throws IOException
     */
    @PostMapping("/info")
    public R<Map> getAirportDetailInfo(@RequestBody GetAirportDetailInfoRequest getAirportDetailInfoRequest) throws IOException {
        Map<String,Object> map = situationScreenService.Info();
        return R.ok(map);
    }

    /**
     * 态势大屏详情
     * @param getAirportDetailInfoRequest
     * @return
     * @throws IOException
     */
    @PostMapping("/resourceScheduling")
    public R<Map> resourceScheduling(@RequestBody GetAirportDetailInfoRequest getAirportDetailInfoRequest) throws IOException {
        Map<String,Object> map = situationScreenService.resourceScheduling();
        return R.ok(map);
    }


    /**
     * 任务列表
     * @param getInspectionTaskListRequestDTO
     * @return
     * @throws IOException
     */
    @PostMapping("/taskList")
    public R<Page<GetInspectionTaskListResponseDTO>> taskList(@RequestBody GetInspectionTaskListRequestDTO getInspectionTaskListRequestDTO) throws IOException {
        Page<GetInspectionTaskListResponseDTO> page = situationScreenService.taskList(getInspectionTaskListRequestDTO);
        return R.ok(page);
    }
}
